package org.onion.pattern.event.springboot.rocketmq.annotation;

import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
import org.apache.rocketmq.remoting.protocol.heartbeat.MessageModel;
import org.onion.pattern.event.springboot.rocketmq.annotation.enums.ListenerMode;

import java.lang.annotation.*;

/**
 * rockmq 消费者组
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RocketMQConsumerGroup {

    String value() default "";

    ListenerMode listenerMode() default ListenerMode.Orderly;

//    String namespace() default "";

    ConsumeFromWhere consumeFromWhere() default ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET;

//    int consumeTimestamp() default 0;

    MessageModel messageModel() default MessageModel.CLUSTERING;

    /**
     * 最大消费线程数
     */
    int consumeThreadMax() default 20;

    /**
     * 最大消费超时时间,默认15分钟
     */
    long consumeTimeout() default 15;

    /**
     * ROCKETMQ服务端地址
     */
//    String nameServer() default "";

    /**
     * 是否做消息幂等
     *
     */
    boolean idempotent() default true;
}
